<?php
namespace app\admin\logic;
use think\facade\Request;

class OrderLogic
{
    public static function getWhere()
    {
        $keywords = Request::param('keywords','');
        $where=[];
        $start_time = Request::param('start_time','');
        $end_time = Request::param('end_time','');
        $order_status = Request::param('order_status','');
        $min_price = Request::param('min_price','');
        $max_price = Request::param('max_price','');
        $where = [];
        if (!empty($keywords))    $where[] = ['order_sn','like',"%{$keywords}%"];
        if (!empty($start_time))  $where[] = ['addtime','> TIME',$start_time];
        if (!empty($end_time))    $where[] = ['addtime','< TIME',$end_time];
        if (!empty($order_status))$where[] = ['status','in',$order_status];
        if (!empty($min_price))   $where[] = ['price','>=',$min_price];
        if (!empty($max_price))   $where[] = ['price','<=',$max_price];
        return [$where];
    }
}